<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>申请服务</title>
	<%@ include file="../common/common.jsp"%>
	<link rel="stylesheet" type="text/css" href="${ctx}/page/soft/css/reset.css" />
	<link rel="stylesheet" type="text/css" href="${ctx}/page/soft/css/style.css" />
	<link rel="stylesheet" type="text/css" href="${ctx}/page/lib/tinyalert/css/zepto.alert.css">
	<script type="text/javascript" src="${ctx}/page/lib/tinyalert/js/zepto.alert.js"></script>
</head>
<body>
	<div id="huandeng" class="agent_head" style="background: url(${ctx}/page/soft/img/timg.jpg) center 0 no-repeat;background-size: 100%;">
		<div class="bgf p10 ba item_con">
			<dl class="table">
				<dt class="table-cell vt">
					<img src="${avatar}" alt="" class="br50 imgm">
				</dt>
				<dd class="table-cell vt pl10">
					<h2 class="fs14">${name}</h2>
					<p class="mt5 col9">
						<c:if test="${level eq 0}">服务：粉丝</c:if>
						<c:if test="${level eq 1}">服务：会员</c:if>
						<c:if test="${level eq 2}">服务：代理</c:if>
					</p>
					<p><span class="fl mr10 col9">ID：${id}</span></p>
				</dd>
			</dl>
		</div>
	</div>
	<div class="plr10 mt10 agent_edition">
		<div class="bgf p10 ba">
			<ul class="mt5 clearfix tc item-choice">
				<li id="huiYuan">
					<label class="vipH typel ba">
						<input id="vip" name="type" type="radio" value="${baseVipSoftFee.vipLevel}">
						<b class="fs15 col3">会员版(月)</b>
						<p class="col9">¥<fmt:formatNumber type="number" value="${baseVipSoftFee.price}" pattern="0.00" maxFractionDigits="2"/></p>
					</label>
				</li>
				<li id="gaoDai">
					<label class="dealG typel ba on">
						<input id="deal" name="type" type="radio" value="${heighVipSoftFee.vipLevel}" checked="true">
						<b class="fs15 col3">代理版(月)</b>
						<p class="col9">¥<fmt:formatNumber type="number" value="${heighVipSoftFee.price}" pattern="0.00" maxFractionDigits="2"/></p>
					</label>
				</li>
<%-- 				<li id="hehuo">
					<label class="hehuoH typel ba">
						<input id="heh" name="type" type="radio" value="${heHuoSoftFee.vipLevel}">
						<b class="fs15 col3">合伙人版</b>
						<p class="col9">¥<fmt:formatNumber type="number" value="${heHuoSoftFee.price}" pattern="0.00" maxFractionDigits="2"/></p>
					</label>
				</li> --%>
			</ul>
			<div class="mt10 item-agree">
				<p class="rule">
					<i class="selected"></i>购买即阅读并同意<a href="" class="blue">《系统在线使用服务协议》</a>
				</p>
			</div>

			<div class="mt10 plr10 tc item-sub">
			<input type="hidden" name="zhifutype" id="zhifutype" value="1">
				<div class="mt10"></div>
				<a href="javascript:;" id="zhifu2" class="br5 fs15 colf">立即购买</a>
				<p class="mt5 col6">注：此费用为软件服务费，有效期为1月(按30天计算)，同级可叠加。</p>
			</div>
		</div>
	</div>
	<div class="plr10 mt10 mb10 agent_tariff">
		<div class="table bgf ptb10 ba tc">
			<div class="table-cell br">
				<a href="http://mp.weixin.qq.com/s/tr3R2C7yxHPJZNGcfwnsCw" class="fs14 blue">系统介绍</a>
			</div>
			<div class="table-cell">
				<a href="http://mp.weixin.qq.com/s/EWJk2o0tqyus5ZqmJteXlg" class="fs14 blue">赚钱攻略</a>
			</div>
		</div>
	</div>
	<script type="text/javascript">
	$(function() {
		$("#deal").checked=true;
		$("#vip").checked=false;
		//$("#heh").checked=false;
		$(".dealG").addClass("on");
		$(".vipH").removeClass("on");
		//$(".hehuoH").removeClass("on");
		var level= '${heighVipSoftFee.vipLevel}';
		$("#gaoDai").on("click",function(event){
			event.stopPropagation();
			$("#deal").checked=true;
			$("#vip").checked=false;
			//$("#heh").checked=false;
			$(".dealG").addClass("on");
			$(".vipH").removeClass("on");
			//$(".hehuoH").removeClass("on");
			level=$("[name='type']").filter(":checked").attr("value"); 
		});
		$("#huiYuan").on("click",function(event){
			event.stopPropagation();
			$("#deal").checked=false;
			$("#vip").checked=true;
			//$("#heh").checked=false;
			$(".vipH").addClass("on");
			$(".dealG").removeClass("on");
			//$(".hehuoH").removeClass("on");
			level=$("[name='type']").filter(":checked").attr("value"); 
		});
		$("#hehuo").on("click",function(event){
			event.stopPropagation();
			$("#deal").checked=false;
			$("#vip").checked=false;
			//$("#heh").checked=true;
			$(".vipH").removeClass("on");
			$(".dealG").removeClass("on");
			//$(".hehuoH").addClass("on");
			level=$("[name='type']").filter(":checked").attr("value"); 
		});
		$("#zhifu2").on("click",function(event){
			//window.location.href=mServerUrl+"/page/confirmSoftOrderPage.htm?level="+level+"&time="+((new Date()).getTime());
			confirmOrder(level);
		});
		
	});
	var flag = true;
	function confirmOrder(level){
		if(flag){
			flag = false;
			var dialog = $.dialog({
		        content : '订单确认中,请稍后...'
		    });
			
			$.ajax({
				type : 'POST',
				url : ctx + '/page/confirmSoftOrder.do',
				data : {
					level:level
				},
				dataType : 'json',
				timeout : 30000,
				context : $('body'),
				success : function(data) {
					dialog.close();
					if (data.code == "ok") {
						flag = true;
						var obj = data.object;
						window.location.href=mServerUrl+"/page/confirmSoftOrderPage.htm?orderNo="+obj.orderNo+"&time="+((new Date()).getTime());
					} else {
						flag = true;
					    $.dialog({
					        content : data.msg,
					        title: "alert",
					        time : 2000
					    });
					}
				},
				error : function(xhr, type) {
					dialog.close();
					flag = true;
				    $.dialog({
				        content : '提交失败!',
				        title: "alert",
				        time : 2000
				    });
				}
			});
		}
	}
	</script>
</body>
</html>